﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;


namespace IHISCETeim.Web.MachineSys.UserModel
{
    public partial class UMacKeepDetailSingAdd : PageBase
    {
        protected string SerialNumber
        {
            get
            {
                return GetRequestValue<string>("SerialNumber", "");
            }
        }
        protected string KeepHours
        {
            get
            {
                return GetRequestValue<string>("KeepHours", "0");
            }
        }

        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.新增 };
            }
        }
        protected override string DWZRef
        {
            get { return "UMacKeepList"; }
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "add")
            {
                addmenu();
            }
        }
        private void addmenu()
        {

            UMacKeepDetailInfo item = Request.SerializableObject<UMacKeepDetailInfo>();            
            int x= UMacKeepController.UMacKeepDetail_Add(item);
            if (x == -1)
            {
                ErrorJson(string.Format("此机号{0}保养时间{1}已添加过保养，无法再次录入", item.SerialNumber, item.KeepHours));
                return;
            }
            AddLog(Permission.新增, item);
            SuccessAlertJson("添加成功");

        }
        
    }
}